require("../../@babel/runtime/helpers/Arrayincludes");

var t = require("../../@babel/runtime/helpers/objectSpread2"), a = require("../../@babel/runtime/helpers/defineProperty"), e = getApp().globalData.api, o = getApp().globalData.tel, i = (getApp(), 
require("../../utils/util.js"));

Page({
    data: {
        addTipflg: !0,
        isShowTip: !0,
        isShowTag: !1,
        floatTagsHeight: 40,
        evluateScrollTopNum: 0,
        tagSelectIdx: 0,
        pageNum: 1,
        pageSize: 10,
        total: 0,
        hosData: null,
        hosCoupon: [],
        evaluateList: [],
        selectMenu: "tc",
        pkgItem: [],
        windowInfo: {
            height: 0,
            width: 0,
            topbarHeight: 45,
            bottomBarHeight: 56,
            tabScrollHeight: 40,
            tabFilterHeight: 40,
            bottomSafeViewHeight: 0,
            isNavBgShow: !1,
            navTitleWidth: 200,
            statusBarHeight: 0,
            safeArraTop: 44,
            pdRight: 80,
            navHeight: 44
        },
        domain: null,
        areacode: null,
        ifCanBook: !1,
        showFullCover: !0,
        originUnitParam: null,
        ifShowShartBtn: getApp().globalData.ifSharebtn,
        h5Url: "",
        atimedata: {
            checkShow: !1,
            strdata: "",
            bool: !1,
            downTime: "",
            time: {
                m: "",
                s: ""
            }
        },
        navScrollInfo: {
            currentSelectIndex: 0
        },
        currentRank: {
            rankName: "zhpx",
            num: !0
        },
        lastSelectObj: {
            choseTagA: !1,
            choseTagB: !1,
            suitSex: "0103",
            suitMarried: "0203",
            min: -1,
            max: 1 / 0
        },
        initSelectObj: {
            choseTagA: !1,
            choseTagB: !1,
            suitSex: "0103",
            suitMarried: "0203",
            min: -1,
            max: 1 / 0
        },
        disPlayGdsList: [], 
        focusFid: -1,
        zhpxShow: null,
        tclxShow: null,
        syrqShow: null,
        ishidden: !1,
        zhpxItem: "",
        syrqItem: "",
        zhpxIndex: null,
        zhpxTagIndex: null,
        syrqIndex: null,
        screenTagName: {
            zhpx: "综合排序",
            tclx: "套餐类型",
            syrq: "适用人群"
        },
        conditionList: [ {
            id: 1,
            title: "适用人群",
            list: [ {
                id: 1,
                text: "男士",
                flag: !1,
                suitSex: "0102",
                suitMarried: "0203"
            }, {
                id: 2,
                text: "女士",
                flag: !1,
                suitSex: "0101",
                suitMarried: "0202"
            }  ]
        } ],
        kefutel:''

    },
    onLoad: function(t) {
        console.log(t, "hospitalinfo");
        var a = t.selectPkgId;
        if (this.setData({
            areacode: t.areacode,
            domain: t.domain,
            selectPkgId: a || ""
        }), this.getWinInfo(), getApp().initShare(t), console.log(getApp().ifShowBtn()), 
        getApp().ifShowBtn()) {
            this.setData({
                ifShowShartBtn: getApp().ifShowBtn()
            });
            var e = "".concat(t.areacode, "/").concat(t.domain);
            this.setData({
                h5Url: getApp().getDisUrl(e, {})
            }), console.log(this.data.h5Url);
        }
    },
    onPkgShareClick: function() {
        var t = this.selectComponent("#shareAlert");
        console.log(t), t.onPkgShareClick();
    },
    getWinInfo: function() {
        var t, e = wx.getSystemInfoSync(), o = wx.getMenuButtonBoundingClientRect(), i = 2 * (o.top - e.statusBarHeight) + o.height;
        this.setData((a(t = {}, "windowInfo.height", e.windowHeight), a(t, "windowInfo.width", e.windowWidth), 
        a(t, "windowInfo.statusBarHeight", e.statusBarHeight), a(t, "windowInfo.navHeight", i), 
        a(t, "windowInfo.bottomSafeViewHeight", e.safeArea.bottom - e.safeArea.height), 
        a(t, "windowInfo.statusBarHeight", e.statusBarHeight), a(t, "windowInfo.safeArraTop", e.safeArea.top), 
        a(t, "windowInfo.navTitleWidth", e.windowWidth - 2 * (e.windowWidth - o.left)), 
        a(t, "windowInfo.pdRight", e.windowWidth - o.left), t));
    },
 
    getDistance: function(t, a, e, o) {
        console.log("juli",t);
        if (t && a && e && o) {
            var i = t * Math.PI / 180, s = e * Math.PI / 180, n = i - s, r = a * Math.PI / 180 - o * Math.PI / 180, h = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(n / 2), 2) + Math.cos(i) * Math.cos(s) * Math.pow(Math.sin(r / 2), 2)));
            return h *= 6378.137, (h = Math.round(1e4 * h) / 1e4).toFixed(1) < 30 ? h.toFixed(1) : 0;
        }
        return 0;
    },
   
    getHosDetaislRq: function() {
        var t = this, a = {
            areacode: this.data.areacode,
            domain: this.data.domain,
            clientType: 2
        };
        console.log(1111111111) 
        e.post1("wechat/home/_getMicroHospitalByArea", a).then(function(a) {            
            if ("1" == a.code) {
                var e = a.data, o = {
                    // averageScore: e.averageScore,
                    // professionScore: (e.professionScore / 20).toFixed(1),
                    
                };
                t.setData({kefutel:e.kefutel});
                e.scoreData = o;
                var i = 1 == e.status;
                //  s = t.getDistance(getApp().globalData.localLatitude, getApp().globalData.localLongitude, e.lat, e.lon);
                // e.distance = s,
               
                var r = [];
                if (e.microHospitalPkgCategoryDTOList) {
                    if (e.commendPkgDTOList.length > 0) {
                        var h = {
                            isCommend: !0,
                            name: "推荐", 
                            categoryId: "-2",
                            categoryPkgList: e.commendPkgDTOList
                        };
                        r.unshift(h);
                    }
                    var c = [];
                    e.microHospitalPkgCategoryDTOList.forEach(function(t) {
                        c = c.concat(t.categoryPkgList);
                    });
                    var l = t.data.selectPkgId;
                    if (c.length > 0 && l && (c = JSON.parse(JSON.stringify(c))).map(function(t, a) {
                        t.id == l && (t.isPkgSelect = !0, c.unshift(c.splice(a, 1)[0]));
                    }), c.length > 0) {
                        var d = {
                            isCommend: !0,
                            name: "全部",
                            subName: "全部",
                            categoryId: "-1",
                            categoryPkgList: c
                        };
                        r.unshift(d);
                    }
                    r = r.concat(e.microHospitalPkgCategoryDTOList);
                }
                e.microHospitalPkgCategoryDTOList = r;
                console.log(233333333333);
            
                var u = t.displayArray(r);
                console.log(u);
                if (t.setData({
                    disPlayGdsList: u,
                    ifCanBook: i,
                    hosData: e
                }), e.name) {
                    var p = "【".concat(e.name, "】_预约_电话_地址_体检时间 - ");
                    wx.setNavigationBarTitle({
                        title: p
                    }), t.setData({
                        title: p
                    });
                }
               
            }
        }, function(t) {}).then(function(a) {
            // t.downTime();
            //  t.requestHosCouponList();
              t.loadData();
            // t.recordHosHistory();
        });
    },
    displayArray: function(t) {
        var a = JSON.parse(JSON.stringify(t));
        if (!(a.length > 0)) return [];
        var e = a[this.data.navScrollInfo.currentSelectIndex].categoryPkgList;
        if (!(e.length > 0)) return [];
        var o = this.data.currentRank.rankName, i = this.data.currentRank.num;
        if ("zhpx" == o || "zhpx1" == o) return e;
        if ("xl" == o) return i ? e.sort(function(t, a) {
            return t.frontOrderCnt - a.frontOrderCnt;
        }) : e.sort(function(t, a) {
            return a.frontOrderCnt - t.frontOrderCnt;
        }), e;
        if ("jg" == o) return i ? (e.sort(function(t, a) {
            return t.price - (t.rebatePrice ? t.rebatePrice : 0) - (a.price - (a.rebatePrice ? a.rebatePrice : 0));
        }), e) : (e.sort(function(t, a) {
            return a.price - (a.rebatePrice ? a.rebatePrice : 0) - (t.price - (t.rebatePrice ? t.rebatePrice : 0));
        }), e);
        if ("tclx" == o) return e;
        var s = this.data.zhpxItem;
        if (37 == s) return e.sort(function(t, a) {
            return a.frontOrderCnt - t.frontOrderCnt;
        }), e;
        if (38 == s) return e.sort(function(t, a) {
            return t.price - a.price;
        }), e;
        if (39 == s) return e.sort(function(t, a) {
            return a.price - t.price;
        }), e;
        var n = this.data.syrqItem;
        if (1 == n) {
            var r = [];
            return e.forEach(function(t, a, e) {
                if ("0102" != t.suitSex || "0203" != t.suitMarried) return !0;
                r.push(t);
            }), r && (e = r), e;
        }
        if (2 == n) {
            var h = [];
            return e.forEach(function(t, a, e) {
                if ("0101" != t.suitSex || "0203" != t.suitMarried) return !0;
                h.push(t);
            }), h && (e = h), e;
        }
        if (3 == n) {
            var c = [];
            return e.forEach(function(t, a, e) {
                if ("0101" != t.suitSex || "0201" != t.suitMarried) return !0;
                c.push(t);
            }), c && (e = c), e;
        }
    },
   
    requestHosHistoryData: function() {
        if (this.data.userInfo) {
            var t = this, a = {
                areacode: this.data.hosData.areacode,
                code: this.data.hosData.domain,
                memberId: this.data.userInfo.id,
                foreignId: this.data.hosData.id,
                browseType: "1",
                browseName: this.data.hosData.name,
                source: getApp().globalData.appInfo.zkSource,
                picUrl: this.data.hosData.bannerFullUrl || this.data.hosData.banner || this.data.hosData.bannerScaleUrl
            };
            e.postPort("getFavoriteMemberBehavior", a, !1).then(function(a) {
                "SUCCESS" == a.result && t.setData({
                    focusFid: a.values
                });
            }, function(t) {});
        }
    },
    requestHosCouponList: function() {
        if (this.data.hosData.id && null != this.data.hosData.id && "undefined" != this.data.hosData.id) {
            var t = this, a = {
                appSource: getApp().globalData.appInfo.zkSource,
                hosId: this.data.hosData.id
            };
            e.postPort("listCanDrawCouponByHosId", a, !1).then(function(a) {
                "SUCCESS" == a.result && Array.isArray(a.values) && t.setData({
                    hosCoupon: a.values
                });
            }, function(t) {});
        }
    },
    loadData: function() {
        this.setData({
            pageNum: 1
        });
        var t = this.data.pageNum;
        // this.resquestEvaluateListData(t);
    },
    loadMoreData: function() {
        var t = this.data.pageNum + 1;
        this.resquestEvaluateListData(t);
    },
    resquestEvaluateListData: function(t) {
        if (this.data.hosData.hosEvaTagDTOList) {
            var a = this, o = this.data.hosData.hosEvaTagDTOList[this.data.tagSelectIdx], i = {
                pageNum: t,
                pageSize: 10,
                searchModel: {
                    evaTagId: o.tagId,
                    orgId: o.orgId
                }
            };
            e.postPort("evaluateLabelList", i, !1).then(function(e) {
                if ("SUCCESS" == e.result) {
                    var o = e.values, i = [];
                    1 != t && (i = a.data.evaluateListArr);
                    for (var s = o.list, n = 0; n < s.length; n++) i.push(s[n]);
                    a.setData({
                        pageNum: o.pageNum,
                        total: o.total,
                        evaluateListArr: i
                    });
                }
            }, function(t) {
                console.log(t);
            });
        }
    },
    downTime: function() {
        if (this.data.hosData.workDateList && !(!this.data.hosData.workDateList.length > 0) && this.data.hosData.bespeakEndTime) {
            var t = this.data.hosData.workDateList[0].split("-"), a = new Date().toLocaleDateString().replace(/\-/g, "/"), e = "".concat(a, " ").concat(this.data.hosData.bespeakEndTime), o = Date.parse(new Date(e)), i = o - 36e5, s = Date.parse(new Date()), n = i < s && s < o;
            if (this.setData({
                "atimedata.strdata": t,
                "atimedata.bool": n
            }), n) {
                var r = this;
                r.data.atimedata.downTime = setInterval(function() {
                    s = Date.parse(new Date());
                    var t = o - s, a = !0;
                    t <= 1 && (clearInterval(r.data.atimedata.downTime), a = !1, n = !1);
                    var e = Math.floor(t / 6e4 + ""), i = Math.floor(t % 6e4 / 1e3 + ""), h = (Array(2).join(0) + e).slice(-2), c = (Array(2).join(0) + i).slice(-2);
                    r.setData({
                        "atimedata.time.m": h,
                        "atimedata.time.s": c,
                        "atimedata.bool": n,
                        "atimedata.checkShow": a
                    });
                }, 1e3);
            }
        }
    },
    menuTap: function(t) {
        this.goScrollTop();
        var a = t.currentTarget.dataset.muneid;
        this.setData({
            selectMenu: a
        });
    },
    goScrollTop: function() {
        var t = this;
        wx.createSelectorQuery().in(this).select("#topView").boundingClientRect(function(a) {
            wx.pageScrollTo({
                scrollTop: a.height - (t.data.windowInfo.navHeight + t.data.windowInfo.safeArraTop),
                duration: 300,
                success: function() {},
                fail: function() {
                    console.log("fail");
                }
            });
        }).exec();
    },
    calendarTap: function(t) {
        this.selectComponent("#hospitalDate").show();
    },
    openDown: function() {
        this.hospitalAd = this.selectComponent("#hospitalAd"), this.hospitalAd.show();
    },
    copyHospitalAdressTap: function(t) {
        wx.setClipboardData({
            data: t.currentTarget.dataset.text,
            success: function(t) {
                wx.getClipboardData({
                    success: function(t) {
                        wx.showToast({
                            title: "复制成功"
                        });
                    }
                });
            }
        });
    },
    cutRankTap: function(t) {
        this.goScrollTop();
        var e = t.currentTarget.dataset.name;
        if ("tclx" == e || "zhpx" == e || "zhpx1" == e || "syrq" == e) {
            var o;
            this.setData((a(o = {}, "currentRank.rankName", e), a(o, "currentRank.num", !1), 
            o));
        } else {
            var i, s = this.data.currentRank.num;
            this.setData((a(i = {}, "currentRank.rankName", e), a(i, "currentRank.num", 1 != s), 
            i));
        }
        var n, r = this.getConditionArray(this.data.lastSelectObj), h = this.data.syrqShow, c = this.data.zhpxShow, l = this.data.tclxShow, d = this.data.ishidden;
        ("zhpx" == e && (c = !0, l = !1, d = !0, h = !1, this.setData(a({}, "screenTagName.syrq", "适用人群"))), 
        "zhpx1" == e && (c = !1, d = !1), "tclx" == e && (l = !0, c = !1, d = !0, h = !1), 
        "syrq" == e && (h = !0, l = !1, c = !1, d = !0), "zhpx1" == e) && this.setData((a(n = {}, "screenTagName.zhpx", "综合排序"), 
        a(n, "screenTagName.syrq", "适用人群"), n));
        this.setData({
            disPlayGdsList: r,
            zhpxShow: c,
            tclxShow: l,
            syrqShow: h,
            ishidden: d
        });
    },
    tcClassTap: function(e) {
        var o;
        this.goScrollTop();
        var i = e.currentTarget.dataset.index, s = e.currentTarget.dataset.tclxselect;
        "全部" == s && (s = "套餐类型"), this.setData(a({}, "navScrollInfo.currentSelectIndex", i));
        var n = this.displayArray(this.data.hosData.microHospitalPkgCategoryDTOList), r = t({}, this.data.initSelectObj);
        this.data.ishidden = !1, this.data.tclxShow = !1, this.setData((a(o = {
            lastSelectObj: r,
            disPlayGdsList: n,
            ishidden: !1,
            tclxShow: !1
        }, "screenTagName.tclx", s), a(o, "screenTagName.syrq", "适用人群"), o));
    },
    evaluatScroll: function(t) {
        var a = this;
        wx.createSelectorQuery().in(this).select(".hd-evalutaion-list-container").boundingClientRect(function(t) {
            var e = a.data.windowInfo.statusBarHeight + a.data.windowInfo.safeArraTop;
            t.top - 40 - e < 0 ? a.setData({
                isShowTag: !0
            }) : a.setData({
                isShowTag: !1
            });
        }).exec();
    },
    pxselct: function(t) {
        var e = t.currentTarget.dataset.zhpxselect, o = t.currentTarget.dataset.index;
        if ("37" == e.id || "38" == e.id || "39" == e.id) {
            var i = e.id, s = e.name;
            this.data.currentRank.rankName = "", this.data.zhpxItem = i;
            var n = s, r = this.data.zhpxItem, h = this.displayArray(this.data.hosData.microHospitalPkgCategoryDTOList);
            this.setData(a({
                disPlayGdsList: h,
                zhpxItem: r
            }, "screenTagName.zhpx", n));
        }
        this.setData({
            ishidden: !1,
            zhpxShow: !1,
            zhpxIndex: o,
            zhpxTagIndex: 1
        });
    },
    syrqSelect: function(t) {
        var e = t.currentTarget.dataset.syrqselect.id, o = t.currentTarget.dataset.syrqselect.text, i = t.currentTarget.dataset.index;
        if (console.log(o, i), 1 == e || 2 == e || 3 == e) {
            this.data.syrqItem = e;
            var s = this.data.syrqItem, n = this.displayArray(this.data.hosData.microHospitalPkgCategoryDTOList);
            this.setData(a({
                disPlayGdsList: n,
                syrqItem: s,
                syrqShow: !1,
                ishidden: !1,
                syrqIndex: i
            }, "screenTagName.syrq", o));
        }
    },
    closeselect: function() {
        this.data.ishidden, this.data.tclxShow, this.data.zhpxShow, this.data.syrqShow;
        this.setData({
            ishidden: !1,
            tclxShow: !1,
            zhpxShow: !1,
            syrqShow: !1
        });
    },
    onPageScroll: function(t) {
        t.scrollTop > 50 ? this.setData(a({}, "windowInfo.isNavBgShow", !0)) : this.setData(a({}, "windowInfo.isNavBgShow", !1));
    },
    hosCollectTap: function() {
        var t = this;
        if (wx.getStorageSync("token")) {
            var a = this.data.focusFid;
            if (a > 0) {
                var o = {
                    rest: a
                };
                e.delPort("deleteMemFavoriteOrg", o, !0).then(function(a) {
                    "SUCCESS" == a.result && a.values && (t.setData({
                        focusFid: 0
                    }), wx.showToast({
                        icon: "none",
                        title: "已取消收藏"
                    }));
                }, function(t) {
                    t.data.hasOwnProperty("result") && "ERROR" == t.data.result && wx.showToast({
                        title: t.data.message[0].message,
                        icon: "none"
                    });
                });
            } else {
                var i = {
                    orgId: this.data.hosData.id
                };
                e.postPort("saveAndUpdateMemFavoriteOrg", i, !0).then(function(a) {
                    "SUCCESS" == a.result && a.values > 0 && (t.setData({
                        focusFid: a.values
                    }), wx.showToast({
                        icon: "none",
                        title: "收藏成功"
                    }));
                }, function(t) {
                    t.data.hasOwnProperty("result") && "ERROR" == t.data.result && wx.showToast({
                        title: t.data.message[0].message,
                        icon: "none"
                    });
                });
            }
        } else wx.navigateTo({
            url: "/pages/login/login"
        });
    },
  
    packageItemTap: function(t) {
        var a = t.currentTarget.dataset.pkginfo;
        this.enterPackageDetail(a);
    },
    enterPackageDetail: function(t) {
        var a = "";
        a = t.hasOwnProperty("sourceId") ? this.data.hosData.domain + "-combo-" + t.sourceId : this.data.hosData.domain + "-combo-n" + t.id;
        var e = "/pages/packagedetails/packagedetails?oid=".concat(a, "&areacode=").concat(this.data.hosData.areacode);
        

        // e = a.hasOwnProperty("sourceId") ? a.hospital.domain + "-combo-" + a.sourceId : a.hospital.domain + "-combo-n" + a.id, 
        // console.log(e, a.hospital), wx.navigateTo({
        //     url: "/pages/packagedetails/packagedetails?oid=".concat(e, "&areaCode=").concat(a.hospital.areaCode)
        // });


        getApp().pushPage(e);
    },
    goHosDiscountTap: function() {
        this.selectComponent("#hostpitalDiscount").show();
    },
     
    goDrawCoupon: function(t) {
        var a = this, o = {
            appSource: getApp().globalData.appInfo.zkSource,
            couponId: t
        };
        e.postPort("getDiscountsNum", o, !0).then(function(e) {
            if ("SUCCESS" == e.result) {
                wx.showToast({
                    icon: "none",
                    title: "领取成功,请尽快使用"
                });
                var o = a.data.hosCoupon;
                o.forEach(function(a) {
                    a.id == t && (a.ifDraw = !1);
                }), a.setData({
                    hosCoupon: o
                });
            }
        }, function(t) {
            t.data.message[0].message && wx.showToast({
                icon: "none",
                title: t.data.message[0].message
            });
        });
    },
    goLogin: function() {
        wx.navigateTo({
            url: "/pages/login/login"
        });
    },
    hosBranchTap: function() {
        var t = "/pages/hospital-branch-list/hospital-branch-list?groupId=".concat(this.data.hosData.groupId, "&areacode=").concat(this.data.hosData.areacode, "&hosId=").concat(this.data.hosData.id);
        getApp().pushPage(t);
    },
    evaluteMoreTap: function() {
        this.loadMoreData();
    },
    evaluteReloadTap: function(t) {
        this.setData({
            tagSelectIdx: t.currentTarget.dataset.idx,
            evluateScrollTopNum: 0
        }), this.loadData();
    },
    hosMapTap: function() {
        var t = this.data.hosData.lat, a = this.data.hosData.lon, e = this.data.hosData.address, o = this.data.hosData.name, s = i.convert2TecentMap(a, t);
        wx.openLocation({
            latitude: s.lat,
            longitude: s.lng,
            name: o,
            address: e
        });
    },
    hosDbTap: function() {
        getApp().pushPage("/pages/hospitalinfo/hospital-package-combo/hospital-package-combo");
    },
    allTjyyTap: function() {
        wx.switchTab({
            url: "/pages/hospital-list/hospital-list"
        });
    },
    otherHospitalTap: function() {
        wx.switchTab({
            url: "/pages/hospital-list/hospital-list"
        });
    },
    phoneTap: function() {
        console.log(this.kefutel);
        wx.makePhoneCall({
            phoneNumber: this.data.kefutel
        });
    },
    hosQaTap: function() {
        wx.navigateTo({
            url: "/subpackages/problems/pages/hospital-problems?hosId=".concat(this.data.hosData.id)
        });
    },
    hosqytjtapw: function() {
        wx.navigateTo({
            url: "/subpackages/group/pages/group_team?code=".concat(this.data.hosData.areacode, "&name=").concat(this.data.hosData.name, "&id=").concat(this.data.id)
        });
    },
    handleContactTwo: function() {
        console.log("handleContact"), wx.openCustomerServiceChat({
            extInfo: {
                url: "https://work.weixin.qq.com/kfid/kfc7b7e2d99e269adf4"
            },
            corpId: "wwd7544c3dc85d4ec3",
            success: function(t) {},
            fail: function(t) {}
        });
    },
    showFuwuPromiseAlertTap: function() {
        this.promise = this.selectComponent("#promise"), this.promise.show();
    },
    showHospitalConditionsAlertTap: function() {
        this.hospitalConditions = this.selectComponent("#hospitalConditions"), this.hospitalConditions.show(this.data.lastSelectObj);
    },
    updateCondtionsSelect: function(t) {
        var a = t.detail, e = this.getConditionArray(a);
        e.length > 0 ? (this.setData({
            disPlayGdsList: e,
            lastSelectObj: a
        }), this.hospitalConditions = this.selectComponent("#hospitalConditions"), this.hospitalConditions.hide()) : wx.showToast({
            title: "没有找到符合条件的套餐!",
            icon: "none"
        });
    },
    getConditionArray: function(t) {
        console.log(t);
        var a = [];
        if (t.choseTagA || t.choseTagB || t.pkgItemIds && t.pkgItemIds.length > 0) for (var e = this.displayArray(this.data.hosData.microHospitalPkgCategoryDTOList), o = JSON.stringify(e), i = JSON.parse(o), s = 0; s < i.length; s++) {
            var n = !1;
            i[s].zkItemLabelIds && (n = this.containsArray(t.pkgItemIds, i[s].zkItemLabelIds)), 
            n && this.checkMoneyRs(i[s], t) && this.checkPeopleRs(i[s], t) && a.push(i[s]);
        } else a = this.displayArray(this.data.hosData.microHospitalPkgCategoryDTOList);
        return a;
    },
    containsArray: function(t, a) {
        a = a.split(",");
        var e = [];
        return e = a.map(function(t) {
            return +t;
        }), t.every(function(t) {
            return e.includes(t);
        });
    },
    checkMoneyRs: function(t, a) {
        if (a.choseTagB) {
            var e = (t.price - (t.rebatePrice ? t.rebatePrice : 0)) / 100;
            return a.min <= e && a.max >= e;
        }
        return !0;
    },
    checkPeopleRs: function(t, a) {
        return !a.choseTagA || ("0102" == a.suitSex ? "0101" != t.suitSex : "0101" != a.suitSex || "0102" != t.suitSex && ("0101" != t.suitSex || !("0201" == t.suitMarried && "0202" == a.suitMarried || "0202" == t.suitMarried && "0201" == a.suitMarried)));
    },
    hospitalInfoTap: function() {
        getApp().globalData.hosData = this.data.hosData, wx.navigateTo({
            url: "/subpackages/hospital/pages/hospital-info/hospital-info"
        });
    },
    hospitalBookInfoTap: function() {
        getApp().globalData.hosData = this.data.hosData, wx.navigateTo({
            url: "/subpackages/hospital/pages/hospital-bookinfo/hospital-bookinfo"
        });
    },
    closeFullCoverTap: function() {
        this.setData({
            showFullCover: !1
        });
    },
    openFullCorverTap: function() {
        this.setData({
            showFullCover: !0
        });
    },
    preventTouchMove: function() {},
    hospitalDetailTap: function(t) {
        var a = t.currentTarget.dataset.info, e = "/pages/hospitalinfo/hospitalinfo?domain=".concat(a.domain, "&areacode=").concat(a.areacode);
        getApp().pushPage(e);
    },
    hosPhotoTap: function(t) {
        getApp().globalData.hosData = this.data.hosData, wx.navigateTo({
            url: "/subpackages/hospital/pages/hospital-photo/hospital-photo"
        });
    },
    imgTap: function(t) {
        for (var a = t.currentTarget.dataset.src, e = t.currentTarget.dataset.list, o = [], i = 0; i < e.length; i++) {
            var s = e[i];
            o.push(s.scaleUrl);
        }
        wx.previewImage({
            current: a,
            urls: o
        });
    },
    onlineTap: function() {
        var t = {
            pagePath: "/pages/hospitalinfo/hospitalinfo",
            hosId: this.data.hosData.id
        };
        getApp().onlineKeFuTap(t);
    },
    onUnload: function() {
        clearInterval(this.data.atimedata.downTime);
    },
    searchPkgTap: function() {
        getApp().globalData.hosData = this.data.hosData, getApp().pushPage("/subpackages/hospital/pages/hospital-package/hospital-package");
    },
    pkgItem: function() {
        var t = this;
        e.getPort("findZkItemLabelList").then(function(a) {
            t.setData({
                pkgItem: a.values
            });
        });
    },
    navBackTap: function() {
        getCurrentPages().length > 1 ? wx.navigateBack({
            delta: 1
        }) : wx.switchTab({
            url: "/pages/homepages/homepages"
        });
    },
    onShow: function() {
        // && this.recordHosHistory()
        // wx.getStorageSync("token") && -1 == this.data.focusFid && this.data.hosData, 
        // this.pkgItem(), 
        this.getHosDetaislRq();
        //  this.getSucAccount();
    
    },
    onReachBottom: function() {},
    onShareAppMessage: function() {
        if (getApp().ifShowBtn()) {
            var t = wx.getStorageSync("disCode"), a = {
                disCode: t = t || getApp().globalData.keyTjgj.disCode,
                domain: this.data.domain,
                areacode: this.data.areacode
            }, e = "";
            for (var o in a) a[o] && (e = e.length > 1 ? "".concat(e, "&").concat(o, "=").concat(a[o]) : "".concat(o, "=").concat(a[o]));
            var i = "/pages/hospitalinfo/hospitalinfo?".concat(e);
            return console.log(i), {
                title: "分享",
                path: i,
                imageUrl: ""
            };
        }
        var s = this.data.hosData.name;
        if (s) return {
            title: s
        };
    }
});